// src/utils/tools.js
import { getCurrentInstance } from 'vue';
import {
    showLoadingToast,
    showSuccessToast,
    showFailToast,
    closeToast,
    showNotify
} from 'vant';


const NOoperation = (options = {}) => {
    let message = typeof options === 'string' ? options : '未知信息';
    let duration = 2000;
    let onClose = () => { };

    if (typeof options === 'object') {
        message = options.message ?? message;
        duration = options.duration ?? duration;
        onClose = typeof options.onClose === 'function' ? options.onClose : onClose;
    }

    showNotify({
        message: message,
        duration,
        color: '#ad0000',
        background: '#ffe1e1',
        onClose: onClose
    });
};

export default {
    install(app) {


        // 挂载到全局
        app.config.globalProperties.$tools = {
            NOoperation
        };
    }
};